import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Solution s=new Solution();
        int n=sc.nextInt();
        int l,r;
        l=sc.nextInt();
        r=sc.nextInt();
        int[]array=new int[100];
        for(int i=0;i<n;i++){
            array[i]=sc.nextInt();
        }
        System.out.println(s.countFairPairs(array,l,r));
    }
}

class Solution {
    public long countFairPairs(int[] nums, int lower, int upper) {
        long res=0;
        int n=nums.length;
        Arrays.sort(nums);
        for(int i=0;i<n;i++){
            int r=fun(nums,i,upper-nums[i]);
            int l=fun(nums,i,lower-nums[i]);
            res+=r-l;
        }
        return res;
    }
    //0 1 7 4 4 5 lower = 3, upper = 6
    //0 1 4 4 5 7
    public int fun(int[] nums,int r,int k){
        int l=-1;
        while(l+1<r){
            int m=(l+r)/2;
            if(nums[m]<k){
                l=m;
            }else{
                r=m;
            }
        }
    return r;
    }
}